/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MenuAdministrador.java
 *
 * Created on 16/Jan/2012, 11:17:19
 */
package menus;

import desint.JanelaPrincipal;
import java.awt.CardLayout;
import javax.swing.JPanel;

/**
 *
 * @author Leonardo Lino
 */
public class MenuAdministrador extends javax.swing.JPanel {
    
    private JanelaPrincipal jp;
    private CardLayout cardlayout;

    /** Creates new form MenuAdministrador */
    public MenuAdministrador() {
        initComponents();
        
        //cardlayout = (CardLayout) (jp.cardHolder.getLayout());
    }
    
    
    public void setJanelaPrincipal(JanelaPrincipal jp){
        this.jp = jp;
    }
    
    public void setCardLayout(JPanel cardLayout){
        CardLayout cl = (CardLayout)(cardLayout.getLayout());
        this.cardlayout = cl;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bGroupAdmin = new javax.swing.ButtonGroup();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        bUtil = new javax.swing.JButton();
        bAgenda = new javax.swing.JButton();
        bAtividade = new javax.swing.JButton();
        bEspaco = new javax.swing.JButton();
        bExercicio = new javax.swing.JButton();
        background = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(95, 481));

        jLayeredPane1.setPreferredSize(new java.awt.Dimension(95, 100));

        bUtil.setIcon(new javax.swing.ImageIcon(getClass().getResource("/user2.png"))); // NOI18N
        bUtil.setToolTipText("Utilizadores");
        bGroupAdmin.add(bUtil);
        bUtil.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bUtilMousePressed(evt);
            }
        });
        bUtil.setBounds(10, 40, 60, 60);
        jLayeredPane1.add(bUtil, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bAgenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/agenda_icon.png"))); // NOI18N
        bAgenda.setToolTipText("Agenda");
        bGroupAdmin.add(bAgenda);
        bAgenda.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bAgendaMousePressed(evt);
            }
        });
        bAgenda.setBounds(10, 120, 60, 60);
        jLayeredPane1.add(bAgenda, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bAtividade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/atividade.png"))); // NOI18N
        bAtividade.setToolTipText("Atividades");
        bGroupAdmin.add(bAtividade);
        bAtividade.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bAtividadeMousePressed(evt);
            }
        });
        bAtividade.setBounds(10, 200, 60, 60);
        jLayeredPane1.add(bAtividade, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bEspaco.setIcon(new javax.swing.ImageIcon(getClass().getResource("/casa.png"))); // NOI18N
        bEspaco.setToolTipText("Espaço Fisico");
        bGroupAdmin.add(bEspaco);
        bEspaco.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bEspacoMousePressed(evt);
            }
        });
        bEspaco.setBounds(10, 290, 60, 60);
        jLayeredPane1.add(bEspaco, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bExercicio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/exercicio.png"))); // NOI18N
        bExercicio.setToolTipText("Exercicios");
        bExercicio.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bExercicioMousePressed(evt);
            }
        });
        bExercicio.setBounds(10, 370, 60, 60);
        jLayeredPane1.add(bExercicio, javax.swing.JLayeredPane.DEFAULT_LAYER);

        background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/back_menu.png"))); // NOI18N
        background.setBounds(0, 0, 140, 480);
        jLayeredPane1.add(background, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    
    private void bUtilMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bUtilMousePressed
        cardlayout.show(jp.cardHolder, "util");
        jp.setMenu(jp.MENU_UTILIZADOR);
        jp.setTexto("Utilizadores");
    }//GEN-LAST:event_bUtilMousePressed

    private void bAtividadeMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bAtividadeMousePressed
        cardlayout.show(jp.cardHolder, "ativ");
        jp.setMenu(jp.MENU_ATIVIDADE);
        jp.setTexto("Atividade");
    }//GEN-LAST:event_bAtividadeMousePressed

    private void bEspacoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bEspacoMousePressed
        cardlayout.show(jp.cardHolder, "espa");
        jp.setMenu(jp.MENU_ESPACO);
        jp.setTexto("Espaço Fisico");

    }//GEN-LAST:event_bEspacoMousePressed

    private void bExercicioMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bExercicioMousePressed
        cardlayout.show(jp.cardHolder, "exer");
        jp.setMenu(jp.MENU_EXERCICIO);
        jp.setTexto("Exercicio");
    }//GEN-LAST:event_bExercicioMousePressed

    private void bAgendaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bAgendaMousePressed
        cardlayout.show(jp.cardHolder, "agen");
        jp.setMenu(jp.MENU_AGENDA);
        jp.setTexto("Agenda");
        
    }//GEN-LAST:event_bAgendaMousePressed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bAgenda;
    private javax.swing.JButton bAtividade;
    private javax.swing.JButton bEspaco;
    private javax.swing.JButton bExercicio;
    private javax.swing.ButtonGroup bGroupAdmin;
    private javax.swing.JButton bUtil;
    private javax.swing.JLabel background;
    private javax.swing.JLayeredPane jLayeredPane1;
    // End of variables declaration//GEN-END:variables
}
